Skip to content

[#670] Add CLI content validation#679

Merged
realproject7 merged 1 commit intomainfrom
task/670-cli-content-validation
Mar 31, 2026
Merged

[#670] Add CLI content validation#679
realproject7 merged 1 commit intomainfrom
task/670-cli-content-validation

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Added title and content length validation to createStoryline() and chainPlot() in the CLI SDK
  • Mirrors limits from lib/content.ts: title ≤60 chars, content 500–10,000 chars
  • Unicode-aware counting ([...str].length) to match web app behavior
  • Validation runs before IPFS upload (fail fast, clear errors)

Changed files

  • packages/cli/src/sdk/client.ts — added validateTitle(), validateContentLength(), called in createStoryline() and chainPlot()

Test plan

  • plotlink create with title >60 chars → error
  • plotlink create with content <500 chars → error
  • plotlink create with content >10,000 chars → error
  • plotlink create with valid title+content → success
  • plotlink chain with content <500 chars → error
  • plotlink chain with valid content → success
  • npm run build passes

Fixes #670

🤖 Generated with Claude Code

Mirrors limits from lib/content.ts in the web app:
- Title max 60 characters (createStoryline only)
- Content min 500 characters
- Content max 10,000 characters

Uses Unicode-aware character counting ([...str].length) to match
the web app's behavior with multi-byte characters.

Validation runs before IPFS upload to fail fast with clear errors.

Fixes #670

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plotlink Ignored Ignored Mar 31, 2026 0:48am

Request Review

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T2b APPROVE

Minimal +26 lines, 1 file:

  1. Constants mirrored from web app — MAX_TITLE_LENGTH=60, MIN/MAX_CONTENT_LENGTH=500/10,000. Consistent with lib/content.ts.
  2. Unicode-aware[...title].length / [...content].length correctly counts codepoints, not UTF-16 code units. Matches web app.
  3. Placement — validates before IPFS upload for fast failure. Title only on createStoryline, content length on both create and chain.
  4. Clear error messages — includes current count vs limit.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The PR implements the CLI half of issue #670 with a minimal, focused change in packages/cli/src/sdk/client.ts. The new validation runs before IPFS upload and uses Unicode-aware character counting to match the web app behavior.

Findings

  • No blocking findings.

Decision

Approve. The code matches the requested limits and applies them in the correct call paths without unrelated changes.

@realproject7 realproject7 merged commit 8fde0af into main Mar 31, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add content length + title length validation to CLI and API indexer

2 participants